package npr.gui;

import processing.core.PImage;

public class PictureButton extends GUI{


    private PImage pressedImage, releasedImage;
    private String fileName;
    boolean pressed= false;


    public PictureButton(int xpos, int ypos, int width, int height, PImage pressedImage, PImage releasedImage){
        
	super(xpos, ypos, width, height);
        this.pressedImage= pressedImage;
	this.releasedImage= releasedImage;
    }


    public boolean isPressed(){

	return pressed;

    }


    protected void mousePressed(int x, int y){

	super.mousePressed(x, y);
	if(inside(x, y)){
	    pressed=!pressed;
	}
    }


    public void draw(){

	if(display){
	    parent.hint(DISABLE_DEPTH_TEST);
	    if(!enabled) parent.tint(255, 150);
	    else parent.tint(255, 255);
	    if(pressed){
		parent.image(pressedImage, xpos, ypos, width, height);
	    }
	    else{
		parent.image(releasedImage, xpos, ypos, width, height);
	    }
	    parent.hint(ENABLE_DEPTH_TEST);
	}
    }
}